<?php
	@session_start();
	$sid=session_id();
	$_id=(int)$_REQUEST['id'];
	$tribe_id=$_id;
	$rs=DbTouch($tribe_db,array('id'=>$_id));
	//print_r($rs);
	$LinkArr=array("全部","登山","徒步","野营","自驾","滑雪","环保公益","户外体育","聚会");
	$TypeArr=array("全部","自由群体","高校户外","俱乐部","兴趣小组","环保公益","其他");
	$DTArr=array("全部","自由群体","高校","俱乐部","环保公益");


	$mode_id=$_REQUEST['m']?$_REQUEST['m']:'index';	
	$mode=array(
				'index'		=> array('module'=>'sub_view_index.php',
										'js'=>array(
													'skin/default/js/view_tribe_index.js',			
											)
									),
				'subject'	=> array('module'=>'sub_view_subject.php','js'=>array('skin/default/js/view_tribe_index.js')),
				'pho'		=> array('module'=>'sub_view_pho.php','js'=>array('skin/default/js/view_tribe_index.js')),
				'abm'		=> array('module'=>'sub_view_pho_setAlbum.php','js'=>array('skin/default/js/view_tribe_index.js')),
				'u'			=> array(
								'module'=>'sub_view_up_photo.php',
								'js'=>array(
									'skin/jquery.uploadify-v2.1.4/swfobject.js',
									'skin/default/js/view_tribe_u_page.js',
									'skin/default/js/global.js',
									'skin/jquery.uploadify-v2.1.4/jquery.uploadify.v2.1.4.min.js',
									'skin/default/js/view_tribe_index.js',
									),
								'css'=>array(),
								),
				's'			=> array('module'=>'sub_view_pho_show.php','js'=>array('skin/default/js/view_tribe_index.js')),
				'act'			=> array('module'=>'sub_view_act.php','js'=>array('skin/default/js/view_tribe_index.js')),
				'ss'			=> array('module'=>'sub_view_subject_show.php','js'=>array('skin/default/js/view_tribe_index.js')),
				);

	$mode_file=$mode[$mode_id]['module'];
	$jsarr=$mode[$mode_id]['js']?$mode[$mode_id]['js']:array();
	$cssarr=$mode[$mode_id]['css']?$mode[$mode_id]['css']:array();
	if(empty($mode_file)){
		jatMessage('参数错误',$public_r['newsurl'].'tribe/');
	}
	if($mode_id=='u'){
		$dbAlbum='phome_jat_album';	
		$AL=DbTouchAll($dbAlbum,array('type'=>TRIBE_ID_ROOT,'referer_id'=>$tribe_id));
		if(empty($AL)){
			jatMessage('请先创建相册','./?id='.$tribe_id.'&m=abm');
		}
	}
	if($lguserid){
		$is_join=DbTouch('phome_jat_jointribe',array('tid'=>$tribe_id,'uid'=>$lguserid))?true:false;
	}
?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
	<title><?=$rs['title']?></title>
	<link href="<?=$public_r['newsurl']?>skin/default/css/reset_css.css" type="text/css" rel="stylesheet" />
<?php foreach($cssarr as $k=>$csslv){?>
	<link href="<?=$public_r['newsurl'].$csslv?>" type="text/css" rel="stylesheet" />
<?php }?>
	<script language="javascript" type="text/javascript" src="<?=$public_r[newsurl]?>skin/default/js/jquery-1.4.4.min.js"></script>
	<script language="javascript" type="text/javascript" src="<?=$public_r[newsurl]?>skin/default/js/global.js"></script>
<?php foreach($jsarr as $k=>$jslv){?>
	<script language="javascript" type="text/javascript" src="<?=$public_r[newsurl].$jslv?>"></script>
<?php }?>
</head>
<body>
<div id="main">
<input type='hidden' id='newsurl' value='<?=$public_r[newsurl]?>' />
<input type='hidden' id='app_id' value='<?=$tribe_id?>' />
<input type='hidden' id='session_id' value='<?=$sid?>' />
<div id="dheader">
     <div id="menus">
		<?=str_replace('[!--news.url--]',$public_r[newsurl],$header['varvalue']);?>       
     </div> 
</div>

	<div id="content">
		<div id="sidebar">
            <h2>分类</h2>
            <ul>
			<?php
					
				$rsTags=$rs['tags'];
				$arrTags=@explode(',',$rsTags);
					
				foreach($LinkArr as $key=>$val){
						if($rsTags && is_array($arrTags) && array_search($val,$arrTags)!==false){
							$str="<strong>$val</strong>";
						}else{
							$str="$val";
						}					
					?>
                <li><a href="<?=$public_r[newsurl]?>tribe/?tg=<?=$key?>"><?php echo $str;?></a></li>
			<?php }?>               
            </ul>
            <span class="bg_bom"></span>
		</div>
		<!-- sidebar结束 -->
		<div id="center">
			<div id="BuLuo">
                <h2>野人部落</h2>
                <ul>				
                    <li><a href="<?=$public_r['newsurl']?>tribe/"><strong>全部</strong></a></li>			
                    <li><a href="<?=$public_r['newsurl']?>tribe/?t=1">自由群体</a></li>
                    <li><a href="<?=$public_r['newsurl']?>tribe/?t=2">高校</a></li>
                    <li><a href="<?=$public_r['newsurl']?>tribe/?t=3">俱乐部</a></li>
                    <li><a href="<?=$public_r['newsurl']?>tribe/?t=4">环保公益</a></li>
                    <li>
                     <select name="z-d" style='display:none;'>
                        <option value="">请选择</option>
                        <option value="">请选择</option>
                        <option value="">请选择</option>
                    </select>
                    </li>
                </ul>
                
                <div class="content">
                    <a href="#"  class="f_left"><img src="<?=$public_r["newsurl"].($rs['cover_url']?$rs['cover_url']:"images/img01.jpg")?>" alt="图片描述" /></a>
                    <div class="f_right">
                    <h4><?=$rs[title]?>: <?=$public_r["newsurl"].'tribe/detail/?id='.$rs['id']?></h4>
                    <p>
                      <?=$rs['content']?>
                    </p>
					
                    </div>

                    <span class="clear"></span><div style='text-align:right;padding:5px 20px;'><a href='<?=$public_r["newsurl"]?>'>管理圈子</a><a href='javascript:void(0);' class='join_btn' style='margin:0px 10px;'  jn='<?=($is_join?1:0)?>'><?=$is_join?'退出圈子':'加入圈子'?></a></div>
                </div>
                
			</div>
			<!-- BuLuo结束 -->            
            <?php include($mode_file);?>
			<!-- GongGao结束 -->          
			
			<!-- Topic结束 -->
            <span class="bg_bom"></span>
		</div>
		<!-- center结束 -->
<div id="right">
        	<div id="search">
            <form action="" method="post">
               <p> 部落搜索
                 <select name="z-d">
                    <option value="">请选择</option>
                    <option value="">请选择</option>
                    <option value="">请选择</option>
                </select></p>
               <p> <input name="" type="text"  style="border:1px solid #ccc;width:180px;"/>
                <input name="" type="submit" value="搜索" /></p>
              </form>
            </div>
            <!-- search结束 -->
            
	    <div id="Group">
		<?php 
			$db_ren='phome_jat_jointribe';
			$rl=DbTouchAll($db_ren,array('tid'=>$tribe_id),'*','order by time desc limit 9');
		?>
          <h3><span><a href="#">更多</a></span>部落族人</h3>
                <ul>
				<?php 
					if($rl){
				foreach($rl as $rk=>$rv){
						$U=getUserInfo($rv['uid']);
						$head=getUserHead($U["userpic"],69,69);
					?>
                    <li>
						<a href="<?=$public_r['newsurl']?>e/member/sp/?uid=<?=$rv['uid']?>">
							<img src="<?=$head?>" alt="<?=$rv['nickname']?>" />
						</a>
						<span>
							<a href="<?=$public_r['newsurl']?>e/member/sp/?uid=<?=$rv['uid']?>"><?=$U['nickname']?></a>
						</span></li>
				<?php }
				}else{?>
				<div class='no-data'>暂时无人加入！</div>
				<?php }?>                  
                </ul>
                <span class="clear"></span>
                <span class="bg_bom"></span>
		</div>
			<!-- Group结束 -->
          <?php 
			$db_sub='phome_jat_tribe_subject';
			$sublist=DbTouchAll($db_sub,array('tribe_id'=>$tribe_id),'*','order by reply_num desc limit 6');
		?>
	    <div id="hot_topic">
          <h3><span><a href="./?m=subject&id=<?=$tribe_id?>">更多</a></span>热门话题</h3>
                <ul>
					<?php 
					if($sublist){
					foreach($sublist as $k=>$val){?>
						<li><a href="./?m=ss&id=<?=$tribe_id?>&sid=<?=$val[id]?>"><?=sub($val['title'],0,20)?></a></li>
					<?php }
					}else{?><div class='no-data'>暂无相关主题！</div><?php }?>
                </ul>
                <span class="bg_bom"></span>
</div>
			<!-- hot_topic结束 -->
            
  <?php 
			$goodList=DbTouchAll("phome_ecms_actives",array("checked"=>1,"isgood"=>1),"*","limit 3");
		?>
	  <div id="huo_dong">
                    <h3><span><a href="<?=$public_r['newsurl']?>act/">更多</a></span>热门活动</h3>

<?php if($goodList){
			  foreach($goodList as $gk=>$gv){
				  $U=getUserInfo($gv[userid]);
			  ?>
       <div>
           <a href="<?=$public_r['newsurl']?>act/detail/?id=<?php echo $gv[id];?>"><img title="<?=$gv['title']?>" alt="<?=$gv['title']?>" src="<?=$gv[active_cover]?>" width='242'></a>
            <h4><a href="<?=$public_r['newsurl']?>act/detail/?id=<?php echo $gv[id];?>"><?=$gv['title']?></a></h4>
            <dl>
               <dt>发 起 人：</dt><dd><a href="<?=$public_r[newsurl]?>e/member/sp/?uid=<?=$gv['userid']?>"><?=$U[nickname]?></a></dd>
                <dt>活动地点：</dt><dd><?=$gv[address]?></dd>
                <dt>活动分类：</dt><dd><?=$gv[active_type]?></dd>
                <dt>活动时间：</dt><dd><?=$gv[start_time]?>至<?=$gv[end_time]?></dd>
                <dt>关注程度：</dt><dd><?=$gv[onclick]?>人感兴趣</dd>
            </dd>
          </div>
<?php }
				  
			  }else{?>
			  <div class='no-data'>暂无数据！</div>
<?php }?>                  
                    <span class="bg_bom"></span>
			</div>
			<!-- huo_dong结束 -->
            
  </div>
		<!-- right结束 -->
        
        
		<span class="clear"></span>
	</div>
	<!-- content结束 --> 
 
     
     <div class="split"></div>
     <div id="footer">
           <div class="copyright">
                <p> 2011 www.yerenbang.org,all rights reserved</p>
                <p>京ICP备09031272号</p>
          </div>
          <a href="#">关于我们</a>|<a href="#">联系方式</a>|<a href="#">意见反馈</a>|<a href="#">友情链接</a>|<a href="#">网站地图</a> 
  </div>
      <!-- footer结束 -->
<div id="bottommain"></div>
    
    </div>
      <!-- main结束 -->
</body>
</html>
